package com.cgbl.service.vm

import android.app.Application
import androidx.databinding.ObservableField
import com.blankj.utilcode.util.StringUtils
import com.cgbl.service.R
import com.robot.base.base.vm.GLBaseViewModel
import com.robot.base.util.ToastUtils
import me.goldze.mvvmhabit.binding.command.BindingAction
import me.goldze.mvvmhabit.binding.command.BindingCommand
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent

class ReleaseProjectViewModel(application: Application) : GLBaseViewModel(application) {
    val promptSelect = ObservableField(false)
    val typeText = ObservableField<String>()
    val list = arrayListOf<String>("APP开发", "游戏开发", "VR开发", "AR开发")
    val uc = UIChangeEvent()

    class UIChangeEvent {
        val showTypeDialog = SingleLiveEvent<Void>()
    }

    init {

    }

    val typeCommand = BindingCommand<Any>(BindingAction {
        uc.showTypeDialog.call()
    })

    val promptClick = BindingCommand<Any>(BindingAction {
        promptSelect.set(!promptSelect.get()!!)
    })

    private fun checkPrompt(): Boolean {
        if (promptSelect.get() == false) {
            ToastUtils.showShort(StringUtils.getString(R.string.app_error_4))
        }
        return promptSelect.get() == false
    }
}